package org.online.utils;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;


public class C3P0Util {
    // 定义C3P0数据源对象
    private static ComboPooledDataSource cpds = new ComboPooledDataSource();

    public static DataSource getDataSource() {
        return cpds ;
    }

    public static Connection getConnection() {
        try {
            return cpds.getConnection() ;
        } catch (SQLException e) {
           throw new RuntimeException(e) ;
        }
    }
}
